<?php

session_start();

require_once( 'config.php' );
require_once( 'functions.php' );
require_once( 'database/Database.php' );
require_once( 'database/User.php' );

$database = new Database( $platform['DB']['host'], $platform['DB']['user'], $platform['DB']['pass'], $platform['DB']['dbname'] );
$script = basename( getVar( 'PHP_SELF', 'SERVER' ) );

if( $script != 'index.php' ) {
  if( getVar( 'userid', 'SESSION' ) ) {
    $id = getVar( 'userid', 'SESSION' );
    $user = User::getUserByID( $id );
  } else {
    header( 'Location: '. $platform['FILE']['url'] .'/index.php' );
  }
}

?>
